import {createBrowserRouter} from "react-router-dom";
import {lazy, Suspense} from "react";

const Home = lazy(() => import('@/pages/home/index.tsx'))
const Login = lazy(() => import('@/pages/login/index.tsx'))
const Register = lazy(() => import('@/pages/register/index.tsx'))
const NotFound = lazy(() => import('@/pages/not_found/index.tsx'))
const Home_Page = lazy(() => import('@/pages/home/home_page/index.tsx'))
const Admin_Information = lazy(() => import('@/pages/authority/admin_information/index.tsx'))
const Admin_Management = lazy(() => import('@/pages/authority/admin_management/index.tsx'))
const Order_Data = lazy(() => import('@/pages/order/order_data/index.tsx'))
const Shopping_Coupon = lazy(() => import('@/pages/order/shopping_coupon/index.tsx'))
const Stock_Management = lazy(() => import('@/pages/order/stock_management/index.tsx'))
const Product_Hot = lazy(() => import('@/pages/product/product_hot/index.tsx'))
const Product_Data = lazy(() => import('@/pages/product/product_data/index.tsx'))
const User_Data = lazy(() => import('@/pages/user/user_data/index.tsx'))
const About = lazy(() => import('@/pages/system/about/index.tsx'))
const Log = lazy(() => import('@/pages/system/log/index.tsx'))
const Set = lazy(() => import('@/pages/system/set/index.tsx'))
const Me = lazy(() => import('@/pages/system/me/index.tsx'))
const Gender = lazy(() => import('@/pages/echarts/gender/index.tsx'))
const Address = lazy(() => import('@/pages/echarts/address/index.tsx'))
const HotProduct = lazy(() => import('@/pages/echarts/hot/index.tsx'))
export const router = createBrowserRouter([
    {
        path: '/',
        element: <Suspense><Home/></Suspense>,
        children: [
            {
                index: true,
                element: <Suspense><Home_Page/></Suspense>,
            },
            {
                path: '/product/management',
                element: <Suspense><Product_Data/></Suspense>,
            },
            {
                path: '/user/data',
                element: <Suspense><User_Data/></Suspense>,
            },
            {
                path: '/order/management',
                element: <Suspense><Order_Data/></Suspense>,
            },
            {
                path: '/product/hot',
                element: <Suspense><Product_Hot/></Suspense>,
            },
            {
                path: '/stock/management',
                element: <Suspense><Stock_Management/></Suspense>,
            },
            {
                path: '/shopping/coupon',
                element: <Suspense><Shopping_Coupon/></Suspense>,
            },
            {
                path: '/admin/information',
                element: <Suspense><Admin_Information/></Suspense>,
            },
            {
                path: '/admin/management',
                element: <Suspense><Admin_Management/></Suspense>,
            },
            {
                path: '/system/about',
                element: <Suspense><About/></Suspense>,
            },
            {
                path: '/system/set',
                element: <Suspense><Set/></Suspense>,
            },
            {
                path: '/system/log',
                element: <Suspense><Log/></Suspense>,
            },
            {
                path: '/system/me',
                element: <Suspense><Me/></Suspense>,
            },
            {
                path: '/data/gender',
                element: <Suspense><Gender/></Suspense>,
            },
            {
                path: '/data/address',
                element: <Suspense><Address/></Suspense>,
            },
            {
                path: '/data/hot',
                element: <Suspense><HotProduct/></Suspense>
            }
        ]
    },
    {
        path: '/login',
        element:
            <Suspense><Login/></Suspense>,
    }
    ,
    {
        path: '/register',
        element:
            <Suspense><Register/></Suspense>,
    }
    ,
    {
        path: '*',
        element:
            <Suspense><NotFound/></Suspense>,
    }
])